﻿using System;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Activation;
using bdnt_pets_system_Entity;
using System.Collections.Generic;
using bdnt_pets_system_Bo.DataManager;
using bdnt_pets_system_Bo.DivisionManager;
using bdnt_pets_system_Bo;

namespace bdnt_pets_system.Web.Services
{
    [ServiceContract(Namespace = "")]
    //[SilverlightFaultBehavior]
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    public class DataService
    {
        [OperationContract]
        public void DoWork()
        {
            // 在此处添加操作实现
            return;
        }

        #region 车间工位管理
        DivisionManager mManger = new DivisionManager();
        // 在此处添加更多操作并使用 [OperationContract] 标记它们
        [OperationContract]
        public List<Tbl_Department> SelectDepartment(string DName)
        {
            return mManger.SelectDepartment(DName);
        }
        [OperationContract]
        public Tbl_Department GetDepartment(Int32 objId)
        {
            return mManger.GetDepartment(objId);
        }
        [OperationContract]
        public bool DeleteDepartment(Int32 objId)
        {
            return mManger.DeleteDepartment(objId);
        }
        [OperationContract]
        public bool SaveDept(Tbl_Department objId)
        {
            return mManger.SaveDept(objId);
        }


        #endregion

        #region 部门人员管理
        TeamManager tm = new TeamManager();

        #region xjh
        [OperationContract]
        public List<Tbl_Team> SelectTeam(string TName)
        {
            return tm.SelectTeam(TName);
        }
        [OperationContract]
        public bool DeleteTeam(Int32 Id)
        {
            return tm.DeleteTeam(Id);
        }
        [OperationContract]
        public bool SaveTeam(Tbl_Team objId)
        {
            return tm.SaveTeam(objId);
        }
        [OperationContract]
        public Tbl_Team GetTeam(Int32 Id)
        {
            return tm.GetTeam(Id);
        }
        #endregion

        #region ys
        [OperationContract]
        public List<Tbl_TeamMemembers> GetTeamMemembers()
        {
            return tm.GetTeamMemembers();
        }

        #endregion

        #endregion

        #region 车辆管理
        VehicleManager vManager = new VehicleManager();
        [OperationContract]
        public List<Tbl_Vehicle> GetVehicleListByCondition(Tbl_Vehicle obj, int pageSize, int currentPage)
        {
            return vManager.GetObjListByCondition(obj, pageSize, currentPage);
        }

        [OperationContract]
        public int GetVehicleListByConditionCount(Tbl_Vehicle obj)
        {
            return vManager.GetObjListByConditionCount(obj);
        }

        [OperationContract]
        public bool SaveVehicle(Tbl_Vehicle cuObj)
        {
            return vManager.SaveObj(cuObj);
        }

        [OperationContract]
        public Int32 SaveVehicle1(Tbl_Vehicle cuObj)
        {
            return vManager.SaveVObj(cuObj);
        }

        [OperationContract]
        public Tbl_Vehicle GetVehicleById(int objId)
        {
            return vManager.GetObjById(objId);
        }
        [OperationContract]
        public bool DeleteCuVehicle(Int32 objId)
        {
            return vManager.DeleteCuObj(objId);
        }

        [OperationContract]
        public Tbl_Vehicle GetNextVehicleByProNo(string productionNo)
        {
            return vManager.GetNextVehicleByProNo(productionNo);
        }
        [OperationContract]
        public Tbl_Vehicle GetVehicleByProNoOrVinNo(string productionNo, string vinNo)
        {
            return vManager.GetVehicleByProNoOrVinNo(productionNo, vinNo);
        }
        #endregion

        #region 缺陷采集管理
        FailureInfoManager fManager = new FailureInfoManager();

        [OperationContract]
        public List<Tbl_FailureInfo> GetFailureInfoListByCondition(Tbl_FailureInfo obj, int pageSize, int currentPage)
        {
            return fManager.GetObjListByCondition(obj, pageSize, currentPage);
        }
        [OperationContract]
        public int GetFailureInfoListByConditionCount(Tbl_FailureInfo obj)
        {
            return fManager.GetObjListByConditionCount(obj);
        }
        [OperationContract]
        public bool SaveFailureInfo(Tbl_FailureInfo cuObj)
        {
            return fManager.SaveObj(cuObj);
        }
        [OperationContract]
        public Tbl_FailureInfo GetFailureInfoById(int objId)
        {
            return fManager.GetObjById(objId);
        }
        [OperationContract]
        public bool DeleteCuFailureInfo(Int32 objId)
        {
            return fManager.DeleteCuObj(objId);
        }

        [OperationContract]
        public List<Tbl_FailureInfo> GetFailureInfoListByPartNo(string partNo, string failName, string en_failName, int pageSize, int currentPage)
        {
            return fManager.GetObjListByPartNo(partNo, failName, en_failName, pageSize, currentPage);
        }

        [OperationContract]
        public int GetFailureInfoListByPartNoCount(string partNo, string failName, string en_failName)
        {
            return fManager.GetObjListByPartNoCount(partNo, failName, en_failName);
        }

        [OperationContract]
        public List<Tbl_PartSta_Relation> GetPartStationListByConditon(string stationIds)
        {
            return fManager.GetPartStationListByConditon(stationIds);
        }
        #endregion

        #region 工位管理
        StationManager sManager = new StationManager();
        [OperationContract]
        public List<Tbl_Station> GetAllStationList()
        {
            return sManager.GetAllObjList();
        }

        [OperationContract]
        public List<Tbl_StationMemebers> GetStationMemebersByCodition(string stationIds)
        {
            return sManager.GetStationMemebersByCodition(stationIds);
        }

        #endregion

        #region 部件
        PartManager pManager = new PartManager();
        [OperationContract]
        public List<Tbl_Part> GetPartListByCondition(Tbl_Part obj, int pageSize, int currentPage)
        {
            return pManager.GetObjListByCondition(obj, pageSize, currentPage);
        }
        [OperationContract]
        public int GetPartListByConditionCount(Tbl_Part obj)
        {
            return pManager.GetObjListByConditionCount(obj);
        }
        [OperationContract]
        public bool SavePart(Tbl_Part cuObj)
        {
            return pManager.SaveObj(cuObj);
        }
        [OperationContract]
        public Tbl_Part GetPartById(int objId)
        {
            return pManager.GetObjById(objId);
        }
        [OperationContract]
        public bool DeleteCuPart(Tbl_Part cuObj)
        {
            return pManager.DeleteCuObj(cuObj);
        }

        #endregion

        #region 车间
        ShopManger spManger = new ShopManger();
        [OperationContract]
        public List<Tbl_Shop> GetShopListByCondition(Tbl_Shop obj, int pageSize, int currentPage)
        {
            return spManger.GetObjListByCondition(obj, pageSize, currentPage);
        }
        [OperationContract]
        public int GetShopListByConditionCount(Tbl_Shop obj)
        {
            return spManger.GetShopObjListByConditionCount(obj);
        }
        [OperationContract]
        public bool SaveShop(Tbl_Shop cuObj)
        {
            return spManger.SaveObj(cuObj);
        }
        [OperationContract]
        public bool DeleteCuShop(Int32 objId)
        {
            return spManger.DeleteCuObj(objId);
        }
        #endregion

        #region 工位
        StationManager stManger = new StationManager();
        [OperationContract]
        public List<Tbl_Station> GetStationListByCondition(Tbl_Station obj, int pageSize, int currentPage)
        {
            return stManger.GetObjListByCondition(obj, pageSize, currentPage);
        }
        [OperationContract]
        public int GetStationListByConditionCount(Tbl_Station obj)
        {
            return stManger.GetObjListByConditionCount(obj);
        }
        [OperationContract]
        public bool SaveStation(Tbl_Station cuObj)
        {
            return stManger.SaveObj(cuObj);
        }
        [OperationContract]
        public bool DeleteCuStation(Int32 objId)
        {
            return stManger.DeleteCuObj(objId);
        }
        #endregion
    }
}
